package com.ccc.util.page;

import java.util.Map;

import com.ccc.model.Manager;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class ManagerInterceptor extends MethodFilterInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1177809939236871346L;

	@SuppressWarnings("unchecked")
	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		String result=null;
		Map session=invocation.getInvocationContext().getSession();
		Manager manager=(Manager)session.get("manager");
		if(manager!=null){
			result=invocation.invoke();
		}
		result=Action.LOGIN;
		return result;
	}

}
